<?php


$b=$_POST['user'];
$c=isset($_POST['content'])?$_POST['content']:die("<script>alert('留言不能为空');window.location.href='liuyan.php'</script>");
$d=$_POST['zt'];
$e=$_POST['ctime']=time();


@mysql_connect('localhost', 'root', 'root');
if (mysql_errno()) {
	die(mysql_errno());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql="insert into `liuyan`(`user_nc`,`content`,`zt`,`ctime`) values('$b','$c','$d','$e') ";

$res=mysql_query($sql);
var_dump($sql);var_dump($res);
if ($res) {
    echo "<script>alert('留言成功');window.location.href='liuyan.php'</script>";
}
else{
    die ("<script>alert('留言失败');window.location.href='liuyan.php'</script>");
}

mysql_close();


?>